import request from '@/utils/request';

// 获取安全设置信息
export function getSecuritySettings() {
  return request({
    url: '/api/security/settings',
    method: 'get'
  });
}

// 获取安全评分
export function getSecurityScore() {
  return request({
    url: '/api/security/score',
    method: 'get'
  });
}

// 绑定邮箱
export function bindEmail(email, verificationCode) {
  return request({
    url: '/api/security/bind-email',
    method: 'post',
    params: {
      email,
      verificationCode
    }
  });
}

// 解绑邮箱
export function unbindEmail(verificationCode) {
  return request({
    url: '/api/security/unbind-email',
    method: 'post',
    params: {
      verificationCode
    }
  });
}

// 发送邮箱验证码
export function sendEmailVerificationCode(email, operation) {
  return request({
    url: '/api/security/send-email-code',
    method: 'post',
    params: {
      email,
      operation
    }
  });
}

// 启用登录保护
export function enableLoginProtection() {
  return request({
    url: '/api/security/enable-login-protection',
    method: 'post'
  });
}

// 禁用登录保护
export function disableLoginProtection(verificationCode) {
  return request({
    url: '/api/security/disable-login-protection',
    method: 'post',
    params: {
      verificationCode
    }
  });
}

// 获取登录日志
export function getLoginLogs(page = 1, size = 10) {
  return request({
    url: '/api/security/login-logs',
    method: 'get',
    params: {
      page,
      size
    }
  });
}
